package com.ust.tk.simpletool;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;

public class MainActivity extends Activity implements OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        // button click
        findViewById(R.id.button1).setOnClickListener(this);
        findViewById(R.id.button2).setOnClickListener(this);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
    
    public void onClick(View v) {
    	Intent intent;
    	
    	switch ( v.getId() ) {
    	case R.id.button1:
    		intent = new Intent(this, CompassActivity.class);
    		startActivity(intent);
    		break;
    	case R.id.button2:
    		intent = new Intent(this, InclinationActivity.class);
    		startActivity(intent);
    		break;
    	}
    }

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
    	Intent intent;

	    switch (item.getItemId()) {
	    case R.id.action_settings:
    		intent = new Intent(this, TestActivity.class);
    		startActivity(intent);
	        return true;
	    default:
	        return super.onOptionsItemSelected(item);
	    }
	}
    
}
